// pages/userCenter/myOrder/index.js
const app = getApp()
const ip=app.globalData.ip
Page({

  /**
   * 页面的初始数据
   */
  data: {
    active: 1,
    myOrder:[],
    myReceiving:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.selectMyReceiving(),
    this.selectMyOrder()
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.selectMyReceiving(),
    this.selectMyOrder()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  //获取我接单
  selectMyReceiving(){
    //let storeId=wx.getStorageSync('storeid')
    wx.request({
      url:ip+ '/StoreToAssignment/selectMyReceiving',
      data:{
        storeId:wx.getStorageSync('storeid')
      },
      method:'GET',
      success:res=>{
        console.log(res.data.data)
        this.setData({
          myReceiving:res.data.data
        })
      }
    })
  },
  //获取我的订单
  selectMyOrder(){
    //let userId=wx.getStorageSync('userId')
    wx.request({
      url:ip+ '/StoreToAssignment/selectMyOrder',
      data:{
        userId:wx.getStorageSync('userid')
      },
      method:'GET',
      success:res=>{
        console.log(res.data.data)
        this.setData({
          myOrder:res.data.data
        })
      }
    })
  }
})